<?php
require_once (dirname(__FILE__)) . "/config/cConfig.php";
$webConfig = new \ampleharvest\cConfig();
require_once $webConfig->C_STR_AMPLEHARVEST_CODE . "/config/cConfig.php";
require_once $webConfig->C_STR_AMPLEHARVEST_CODE . "/classes/User_Manager/cUserValidation.php";

$codeConfig = new \ampleharvest\code\cConfig();
require_once $codeConfig->C_STR_USER_MANAGER_LIB_PATH . "/Abstract_Classes/abs_UserValidation.php";

//Require Login
$obj_UserValidation = new cUserValidation();
// Check Login Status
if ($obj_UserValidation->is_LoggedIn()){
	$success = setcookie("user-authorized", 'true', 0, '/');	
	$destination = abs_UserValidation::get_PageBaseURL(true). $_SERVER['REQUEST_URI'];
	header('Location: '.$destination);
	exit();
}else{
	$obj_UserValidation->redirect_ToLogin(true);
}